import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @version 1.0
 * @program: JavaStage3Project
 * @description: 流水号类
 * @author: Kishan Liu
 * @create: 2021-12-10 23:44
 **/
public class SerialNumber {
    private String fixedNumber;//固定长度数字
    private String parameter;//流水号参数
    private String data;//日期
    private String number;//流水号
    private int index;//固定长度数字的参数

    public SerialNumber() {
        this.fixedNumber="000000";
        this.index=0;
        Date day = new Date();
        SimpleDateFormat str = new SimpleDateFormat("yyyyMMdd" );
        this.data= str.format(day);
    }


    public void setFixedNumber(String fixedNumber) {
        this.fixedNumber = fixedNumber;
    }


    public void setParameter(String parameter) {
        this.parameter = parameter;
    }


    public void setData(String data) {


    }

    public SerialNumber(String parameter) {
        this.fixedNumber=this.fixedNumber+1;
        this.parameter = parameter;
        this.number=this.parameter+this.fixedNumber;
    }


    public String getParameter() {
        return parameter;
    }

    public void setNumber(String parameter) {
        this.index++;
        DecimalFormat df = new DecimalFormat("000000");
        this.fixedNumber= df.format(index);
        this.number = parameter+this.fixedNumber;
    }

    public void setNumber() {
        this.index++;
        DecimalFormat df = new DecimalFormat("000000");
        this.fixedNumber= df.format(index);
        this.number = this.data+this.fixedNumber;
    }


    public String getNumber() {
        return number;
    }

    public SerialNumber(int i) {
        this.number=this.data+this.fixedNumber;
    }
}
